package com.jinmdz.fmis.mapper.mapper;

import org.apache.ibatis.annotations.*;
import com.jinmdz.fmis.mapper.mapper.provider.MournCeremonyProvider;
import com.jinmdz.fmis.mapper.entity.MournCeremonyEntity;

import java.util.ArrayList;

/**
 * 礼厅业务表Mapper
 * 
 * @author generator
 * @date 2020-08-23 18:11
 */
public interface MournCeremonyMapper {

    /**
     * 增加MournCeremony
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @InsertProvider(type = MournCeremonyProvider.class, method = "insertMournCeremony")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertMournCeremony(@Param("entity") MournCeremonyEntity entity);

    /**
     * 删除MournCeremony
     * 
     * @param id 主键
     * @param modifiedUserId 修改用户外键
     * @param version 版本号
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Update(" update mourn_ceremony set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForMournCeremony(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改MournCeremony
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @UpdateProvider(type = MournCeremonyProvider.class, method = "updateMournCeremony")
    void updateMournCeremony(@Param("entity") MournCeremonyEntity entity);

    /**
     * 查询MournCeremony实体
     * 
     * @param id 主键
     * @return MournCeremonyEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Select(" select id,deleted,business_code,hall_type_code,hall_id,appointment_in_time,appointment_out_time,reality_in_time,reality_out_time,process_state_code,rule_number,rule_unit,rule_code,rule_remark,remark,business_type,random_code,charge_id,session_number_id,couplet_top,couplet_left,couplet_right,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from mourn_ceremony where id = #{id} and deleted = 0 limit 1 ")
    MournCeremonyEntity getMournCeremonyById(@Param("id") Integer id);

    /**
     * 查询MournCeremony列表
     * 
     * @param entity 数据实体
     * @return MournCeremonyEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @SelectProvider(type = MournCeremonyProvider.class, method = "listMournCeremony")
    ArrayList<MournCeremonyEntity> listMournCeremony(@Param("entity") MournCeremonyEntity entity);
}